<template>
  <pageTabelLayout>
    <template #pageHeader>
      <div class="search-form" v-if="headerShow">
        <a-form ref="formRef" size="small" :model="pageData" layout="inline">
          <a-form-item label-col-flex="80px" label="编制日期">
            <a-date-picker popup-container="html" :time-picker-props="{ defaultValue: '00:00:00' }" format="YYYY-MM-DD"
                           class="bacClass" style="width:220px" v-model="pageData.authorizedDate"/>
          </a-form-item>
          <a-form-item label-col-flex="80px" label="配方单号">
            <a-input style="width:220px" class="bacClass" v-model="pageData.formulaOdd" allow-clear></a-input>
          </a-form-item>
          <a-form-item label-col-flex="80px" label="流转卡号">
            <a-input style="width:220px" class="bacClass" v-model="pageData.flowCardCode" allow-clear></a-input>
          </a-form-item>
          <a-form-item label-col-flex="80px" label="计划单号">
            <a-input style="width:220px" class="bacClass" v-model="pageData.planOrderCode"
                     allow-clear></a-input>
          </a-form-item>
          <a-form-item label-col-flex="80px" label="作业性质">
            <a-input style="width:220px" class="bacClass" v-model="pageData.property" allow-clear></a-input>
          </a-form-item>
          <a-form-item label-col-flex="80px" label="布号">
            <a-input style="width:248px" class="bacClass" v-model="pageData.greyCode" allow-clear></a-input>
          </a-form-item>
          <a-form-item label-col-flex="80px" label="品名">
            <a-input style="width:248px" class="bacClass" v-model="pageData.productName" allow-clear></a-input>
          </a-form-item>
        </a-form>
      </div>
      <div class="my-divisders">
        <a-divider orientation="center">
          <icon-double-up v-if="headerShow" @click="headerShow = false" :strokeWidth="2" :size="18"/>
          <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18"/>
        </a-divider>
      </div>
      <div class="my-tool-bar">
        <Toolbar :items="['查询', '新增', '打印正常单', '打印加料单', '套打染部工作单', '导入中转站']" @add="addHandler"
                 @select="selectHandler" @dyNormal="dyNormal" @dyFeed="dyFeed" @dyWork="dyWork"
                 @ImportBroker="ImportBroker">
        </Toolbar>
      </div>
    </template>
    <template #pageTabel>
      <a-spin :loading="pageData.pageLoading" tip="加载中" dot style="height:98%;width: 100%;z-index:999 ;">
        <AgGridVuesCopys :rowHeight="33" :headerHeight="33" :suppressDragLeaveHidesColumns="true"
                         :suppressCopyRowsToClipboard="true" rowSelection="multiple" @grid-ready="gridReady"
                         style="height:calc(100% - 45px)" :defaultColDef="defaultColDef" class='ag-theme-alpine'
                         :rowData="table.dataList"
                         :columnDefs="tc" :localeText="localeText1" @columnResized="onColumnResized"
                         @columnMoved="onColumnMoved"></AgGridVuesCopys>
        <paginationCopys :page-size-options="pagingList1" :total="total" show-total show-jumper show-page-size
                         :page-size="size" :current="page" @change="PageSize" @page-size-change="change1"
                         style="justify-content: center"/>
      </a-spin>
    </template>
    <a-drawer style="z-index:999" ok-text='保存' cancel-text='关闭' :drawer-style="{ 'zIndex': 999 }"
              :mask-closable="false"
              popup-container=".arco-tabs-content" height="100%" :visible="pageData.showAdd" placement="bottom"
              unmountOnClose
              @ok="sideOk" @cancel="sideNo">
      <template #title>
        {{ pageData.sideTitle }}
      </template>
      <a-space style="float: right; margin-right: -15px;">
        <div class="my-tool-bar" style="text-align: right; margin-bottom: -40px;z-index: 9999;">
          <Toolbar style="margin: 0 auto;float:right"
                   :items="['添加程序号', '计算浴比', '流转卡号拷贝', '配方单号拷贝']"
                   @addNumbers="addNumbers" @CountBath="CountBath" @flowCardCopy="visible3 = true"
                   @formulaOddCopy="visible5 = true">
          </Toolbar>
        </div>
      </a-space>
      <a-tabs   :lazy-load="true" :justify="true" default-active-key="1" @change="handoff">
        <a-tab-pane title="缸卡信息" key="1">
          <div style="overflow-y:auto;height: 100%;">
            <a-form style="width: 100%;" size="small" ref="inline" layout="horizontal" :model="dataForm"
                    :label-col-props="{ span: 11 }" :wrapper-col-props="{ span: 13 }">
              <a-space>
                <a-form-item style="width:300px" label-col-flex="100px" label="配方单号" field="formulaOdd"
                             :rules="[{ required: true, message: '配方单号必填' }]">
                  <a-input disabled class="bacClass" v-model="dataForm.formulaOdd"/>
                </a-form-item>
                <a-form-item label-col-flex="100px" style="width:300px" label="性质" field="property"
                             :rules="[{ required: true, message: '性质必填' }]">
                  <a-select popup-container="html" class="bacClass" :loading="loading" @search="handleSearch"
                            @focus="focusSel"
                            @change="Change4()" v-model="dataForm.property" :filter-option="false" allow-search
                            allow-clear style="width: 150px" :disabled="pageData.isEdit">
                    <a-option v-for="item in pageData.xzList" :value="item.property">{{
                        item.property
                      }}
                    </a-option>
                  </a-select>
                  <a-input style="width:150px;" class="bacClass" disabled
                           v-model="dataForm.propertyStater"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="作业类型" field="jobType"
                             :rules="[{ required: true, message: '作业类型必填' }]">
                  <a-select popup-container="html" class="bacClass" :loading="loading1" @search="handleSearch1"
                            @focus="focusSel1" v-model="dataForm.jobType" :filter-option="false" allow-search
                            allow-clear :disabled="pageData.isEdit">
                    <a-option v-for="item in pageData.zyList" :value="item.jobType">{{
                        item.jobType
                      }}
                    </a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="编制日期" field="authorizedDate"
                             :rules="[{ required: true, message: '编制日期必填' }]">
                  <a-date-picker popup-container="html" class="bacClass" :disabled="pageData.isEdit"
                                 v-model="dataForm.authorizedDate" :defaultValue="getCurrentData()"
                                 :showToday="false" valueFormat="YYYY-MM-DD" format="YYYY-MM-DD"/>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="流转卡号" field="flowCardCode"
                             :rules="[{ required: true, message: '流转卡号必填' }]">
                  <a-select popup-container="html" class="bacClass" v-model="dataForm.flowCardCode" @focus="focusSel2"
                            @search="handleSearch2" @change="cardChange" :loading="loading3" allow-clear
                            allow-search :disabled="pageData.isEdit">
                    <a-option v-for="item in pageData.cardList" :value="item.flowCardCode">
                      {{ item.flowCardCode }}
                    </a-option>
                  </a-select>
                </a-form-item>
              </a-space>
              <a-space>
                <a-form-item style="width:300px" label-col-flex="100px" label="客户名称">
                  <a-input disabled class="bacClass" v-model="dataForm.customName"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="色号">
                  <a-input disabled class="bacClass" v-model="dataForm.colorCode"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="色称">
                  <a-input disabled class="bacClass" v-model="dataForm.colorName"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="确认色">
                  <a-input disabled class="bacClass" v-model="dataForm.affirmColour"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="匹数">
                  <a-input disabled class="bacClass" v-model="dataForm.houseNum"></a-input>
                </a-form-item>
              </a-space>
              <a-space>
                <a-form-item style="width:300px" label-col-flex="100px" label="总重量">
                  <a-input disabled class="bacClass" v-model="dataForm.alwaysWeight"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="类型" field="types"
                             :rules="[{ required: true, message: '类型必填' }]">
                  <a-select popup-container="html" class="bacClass" v-model="dataForm.types"
                            :disabled="pageData.isEdit">
                    <a-option>车间方</a-option>
                    <a-option>化验方</a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="机台号" field="machineOdd">
                  <a-select popup-container="html" class="bacClass" v-model="dataForm.machineOdd" @focus="focusSel4"
                            @search="handleSearch4" @change="handCode" :loading="loading4" allow-clear
                            allow-search :disabled="pageData.isEdit">
                    <a-option v-for="item in pageData.machineList"
                              :value="item.controlMachineCode + '——' + item.controlMachineName">
                      {{ item.controlMachineCode + ' —— ' + item.controlMachineName }}
                    </a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="布号">
                  <a-input disabled class="bacClass" v-model="dataForm.greyCode"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="品名" field="property">
                  <a-input disabled class="bacClass" v-model="dataForm.productName"></a-input>
                </a-form-item>
              </a-space>
              <a-space>
                <a-form-item style="width:300px" label-col-flex="100px" label="计划单号">
                  <a-input disabled class="bacClass" v-model="dataForm.planOrderCode"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="纱批">
                  <a-input disabled class="bacClass" v-model="dataForm.yarnBatch"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="对色师傅">
                  <a-select popup-container="html" class="bacClass" :loading="loading3" @search="handleSearch3"
                            @focus="focusSel3" v-model="dataForm.affirmColourName" :filter-option="false"
                            allow-search allow-clear :disabled="pageData.isEdit">
                    <a-option v-for="item in pageData.dsList" :value="item.name">{{
                        item.name
                      }}
                    </a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="浴比">
                  <a-input class="bacClass" v-model="dataForm.bathRatio"
                           :disabled="pageData.isEdit"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="资料员">
                  <a-select popup-container="html" class="bacClass" :loading="loading3" allow-clear allow-search
                            @search="handleSearch3" @focus="focusSel3" v-model="dataForm.documenter"
                            :disabled="pageData.isEdit">
                    <a-option v-for="item in pageData.zlList" :value="item.name">{{
                        item.name
                      }}
                    </a-option>
                  </a-select>
                </a-form-item>
              </a-space>
            </a-form>

            <!-- 拼缸信息 -->
            <!-- <div style="width:40%;float: right;height: 0;margin-top: -1px;">
                            <span style="color:#1681FF;">拼缸信息</span>
                            <div style="width:55px;height:3px;background-color:#165DFF"></div>
                            <a-divider style="margin-top:-1px" />
                        </div> -->
            <a-table title="拼缸信息" size="mini" :scrollbar="true" sticky-header stripe
                     style="height:31%;width: 40%;margin: 0 auto;float: right;margin-top: 20px;"
                     :row-selection="{ showCheckedAll: true, width: 50, onlyCurrent: true }"
                     v-model:selected-keys="selectedRowKeys2" row-key="id" :bordered="{ cell: true }"
                     :pagination="false" :columns="tableColumns2" :data="Tanks">
              <template #flowCardCode="{ record }">
                {{ record.flowCardCode }}
              </template>
              <template #loneNumber="{ record }">
                {{ record.loneNumber }}
              </template>
              <template #byPieceGramWeight="{ record }">
                {{ record.byPieceGramWeight }}
              </template>
              <template #gradeName="{ record }">
                {{ record.gradeName }}
              </template>
            </a-table>

            <!-- 浴比 -->
            <a-table size="mini" :scrollbar="true" sticky-header stripe
                     style="height:31%;width: 59%;margin-top: 20px;" v-model:selected-keys="selectedRowKeys1"
                     row-key="id" :bordered="{ cell: true }" :pagination="false" :columns="tableColumns1"
                     :data="Crafts">
              <template #project="{ record }">
                {{ record.project }}
              </template>
              <template #programNumber="{ record }">
                {{ record.programNumber }}
              </template>
              <template #bathRatioOne="{ record }">
                {{ record.bathRatioOne }}
              </template>
              <template #bathRatio="{ record }">
                {{ record.bathRatio }}
              </template>
              <template #assistantVatMinWater="{ record }">
                {{ record.assistantVatMinWater }}
              </template>
              <template #saltWater="{ record }">
                {{ record.saltWater }}
              </template>
            </a-table>

            <!-- 程序号列表 -->
            <a-table size="mini" :scrollbar="true" sticky-header stripe
                     style="height:38%;width:100%;margin-top: 10px;" v-model:selected-keys="selectedRowKeys3"
                     row-key="isTypeIds" :bordered="{ cell: true }" :pagination="false" :columns="tableColumns3"
                     :data="Programs">
              <template #del="{ record }">
                <icon-delete v-if="(record.programNumber != '')"
                             style="cursor: pointer;color: red;font-size: 25px;" @click="delRow(record)"/>
              </template>
              <template #dyeProcessName="{ record }">
                {{ record.dyeProcessName }}
              </template>
              <template #programNumber="{ record }">
                {{ record.programNumber }}
              </template>
              <template #programName="{ record }">
                {{ record.programName }}
              </template>
              <template #thickenerStep="{ record }">
                {{ record.thickenerStep }}
              </template>
              <template #materialCode="{ record }">
                {{ record.materialCode }}
              </template>
              <template #materialName="{ record }">
                {{ record.materialName }}
              </template>
              <template #category="{ record }">
                {{ record.category }}
              </template>
              <template #percentage="{ record }">
                <a-input-number v-model="record.percentage" class="bacClass" :precision="0"
                                @change="Change2(record)"/>
              </template>
              <template #bathRatio="{ record }">
                {{ record.bathRatio }}
              </template>
              <template #waterYield="{ record }">
                <a-input-number v-model="record.waterYield" class="bacClass" :min="0"
                                @change="Change3(record)"/>
              </template>
              <template #alwaysConcentration="{ record }">
                <a-input-number v-model="record.alwaysConcentration" class="bacClass" @change="Change5"/>
              </template>
              <template #materialRatio="{ record }">
                <a-input v-model="record.materialRatio" class="bacClass"></a-input>
              </template>
              <template #concentration="{ record }">
                {{ record.concentration }}
              </template>
              <template #concentrationUnit="{ record }">
                {{ record.concentrationUnit }}
              </template>
              <template #material="{ record }">
                {{ record.material }}
              </template>
              <template #unit="{ record }">
                {{ record.unit }}
              </template>
              <template #operatingSteps="{ record }">
                {{ record.operatingSteps }}
              </template>
              <template #automanual="{ record }">
                {{ record.automanual }}
              </template>
              <template #assistantVatMinWater="{ record }">
                {{ record.assistantVatMinWater }}
              </template>
              <template #saltWater="{ record }">
                {{ record.saltWater }}
              </template>
              <template #MaxLimit="{ record }">
                {{ record.MaxLimit }}
              </template>
              <template #batchNumber="{ record }">
                {{ record.batchNumber }}
              </template>
              <template #adjust="{ record }">
                {{ record.adjust }}
              </template>
              <!-- <template #processingStep="{ record }">
                            {{ record.processingStep }}
                        </template>
                        <template #null="{ record }">
                            {{ record.null }}
                        </template> -->
              <template #materialType="{ record }">
                {{ record.materialType }}
              </template>
              <template #chargingBasket="{ record }">
                {{ record.chargingBasket }}
              </template>
              <!-- <template #null2="{ record }">
                            {{ record.null2 }}
                        </template>
                        <template #subClassName="{ record }">
                            {{ record.subClassName }}
                        </template> -->
              <template #bathRatioOne="{ record }">
                {{ record.bathRatioOne }}
              </template>
              <template #meansDelivery="{ record }">
                {{ record.meansDelivery }}
              </template>
            </a-table>
          </div>
        </a-tab-pane>

        <!-- 其他信息页签 -->
        <a-tab-pane title="其他信息" key="2">
          <div style="overflow-y:auto;height: 100%;">
            <a-form ref="formRef" layout="horizontal" size="small" :model="dataForm2"
                    :label-col-props="{ span: 11 }" :wrapper-col-props="{ span: 13 }">
              <a-space>
                <!-- <a-form-item style="width:300px" label-col-flex="100px" label="复样员" field="checker"
                                    :rules="[{ required: true, message: '复样员必填' }]">
                                    <a-select popup-container="html"  class="bacClass" :loading="loading3" @search="handleSearch3"
                                        @focus="focusSel3" v-model="dataForm2.checker" :filter-option="false" allow-search
                                        allow-clear>
                                        <a-option v-for="item in pageData.fyList" :value="item.name">{{ item.name
                                        }}</a-option>
                                    </a-select>
                                </a-form-item> -->
                <a-form-item style="width:300px" label-col-flex="100px" label="机速">
                  <a-select popup-container="html" class="bacClass" :loading="loading5" @search="handleSearch5"
                            @focus="focusSel5" v-model="dataForm2.machineSpeed" :filter-option="false"
                            allow-search allow-clear>
                    <a-option v-for="item in pageData.jsList" :value="item.machineSpeed">{{
                        item.machineSpeed
                      }}
                    </a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="风机">
                  <a-select popup-container="html" class="bacClass" :loading="loading6" @search="handleSearch6"
                            @focus="focusSel6" v-model="dataForm2.styles" :filter-option="false" allow-search
                            allow-clear>
                    <a-option v-for="item in pageData.fjList" :value="item.draughtFan">{{
                        item.draughtFan
                      }}
                    </a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="喷嘴">
                  <a-select popup-container="html" class="bacClass" :loading="loading7" @search="handleSearch7"
                            @focus="focusSel7" v-model="dataForm2.nozzle" :filter-option="false" allow-search
                            allow-clear>
                    <a-option v-for="item in pageData.pzList" :value="item.nozzle">{{
                        item.nozzle
                      }}
                    </a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="主泵">
                  <a-select popup-container="html" class="bacClass" :loading="loading8" @search="handleSearch8"
                            @focus="focusSel8" v-model="dataForm2.mainPump" :filter-option="false" allow-search
                            allow-clear>
                    <a-option v-for="item in pageData.zbList" :value="item.mainPump">{{
                        item.mainPump
                      }}
                    </a-option>
                  </a-select>
                </a-form-item>
              </a-space>
              <a-space>
                <!-- <a-form-item style="width:300px" label-col-flex="100px" label="涤重量">
                                    <a-input-number v-model="dataForm2.washWeight" class="bacClass" allow-clear />
                                </a-form-item> -->
                <a-form-item style="width:300px" label-col-flex="100px" label="门幅">
                  <a-input disabled class="bacClass" v-model="dataForm2.efficacious"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="克重">
                  <a-input disabled class="bacClass" v-model="dataForm2.gramWeight"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="颜色深浅">
                  <a-input disabled class="bacClass" v-model="dataForm2.colourDepth"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="布长">
                  <a-input disabled class="bacClass" v-model="dataForm2.clothLength"></a-input>
                </a-form-item>
              </a-space>
              <a-space>
                <a-form-item style="width:300px" label-col-flex="100px" label="步骤个数">
                  <a-input-number v-model="dataForm2.numbers" class="bacClass" allow-clear disabled/>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="副缸扣水">
                  <a-input-number v-model="dataForm2.assistantWater" class="bacClass" allow-clear
                                  :min="0"/>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="工艺时间">
                  <a-input-number v-model="dataForm2.craftDate" :precision="0" class="bacClass"
                                  allow-clear/>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="染色吸水率">
                  <a-input disabled class="bacClass" v-model="dataForm2.dyeWater"></a-input>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="其他吸水率">
                  <a-input-number v-model="dataForm2.waterAbsorption" class="bacClass" allow-clear/>
                </a-form-item>
              </a-space>
              <a-space>
                <a-form-item style="width:300px" label-col-flex="100px" label="行布">
                  <a-select popup-container="html" class="bacClass" v-model="dataForm2.rowCloth" allow-clear>
                    <a-option>单</a-option>
                    <a-option>双</a-option>
                  </a-select>
                </a-form-item>
                <a-form-item style="width:300px" label-col-flex="100px" label="拼缸缸卡">
                  <a-input disabled class="bacClass" v-model="dataForm2.flowCardCodes"></a-input>
                </a-form-item>
              </a-space>
              <a-form-item label-col-flex="100px" label="备注">
                <a-textarea class="bacClass" style="height:70px;" v-model="dataForm2.remark"
                            auto-size="true" :max-length="400" allow-clear show-word-limit/>
              </a-form-item>
            </a-form>
          </div>
        </a-tab-pane>
      </a-tabs>
    </a-drawer>

    <!-- 详情 -->
    <a-modal v-model:visible="visible1" title="配方单号明细" :width="1200" :footer="false" :draggable="true">
      <a-table :style="{
                height: '100%',
                marginTop: '10px'
            }" stripe :bordered="true" :scrollbar="true" sticky-header :columns="tableColumns6"
               :data="pageData.isDetailsList">
      </a-table>
    </a-modal>

    <!-- 添加程序号 -->
    <a-modal fullscreen v-model:visible="visible2" :on-before-ok="handleOk" @cancel="handleNo" :mask-closable="false">
      <template #title> 选择程序号信息</template>
      <div style="width: 60%; display: flex; justify-content: space-between;margin-left: 30px;">
        <div>
          <span>程序号：</span>
          <a-input @press-enter="Query" class="bacClass" v-model="programNumber" :style="{ width: '200px' }"
                   allow-clear/>
        </div>
        <div>
          <span>程序名称：</span>
          <a-input @press-enter="Query" class="bacClass" v-model="programName" :style="{ width: '200px' }"
                   allow-clear/>
        </div>
        <Toolbar :items="['查询']" @select="Query"></Toolbar>
      </div>
      <a-table :style="{ height: '600px', marginTop: '10px' }"
               :row-selection="{ showCheckedAll: true, width: 50, onlyCurrent: true }" row-key="isTypeIds"
               v-model:selected-keys="selectedRowKeys4" stripe :bordered="true" :scrollbar="true" sticky-header
               :pagination="false" :columns="tableColumns4" :data="dataList" size="mini">
      </a-table>
      <paginationCopys :page-size-options="pagingList1" :total="listPage.total" show-total show-jumper show-page-size
                       @change="PageSize2" @page-size-change="change2" style="justify-content: center; margin-top: 50px"
                       :page-size="listPage.size" :current="listPage.page"/>
    </a-modal>

    <!-- 拷贝流转卡号 -->
    <a-modal v-model:visible="visible3" title="选择流转卡号拷贝" :draggable="true" @ok="handleOk1"
             @cancel="handleCancel1">
      <a-form :model="dataForm" :label-col-props="{ span: 6 }" :wrapper-col-props="{ span: 18 }">
        <a-form-item label="流转卡号">
          <a-select popup-container="html" class="bacClass" v-model="dataForm3.flowCardCode" @focus="focusSel9"
                    @search="handleSearch9"
                    :loading="loading9" allow-clear allow-search>
            <a-option v-for="item in pageData.cardList2" :value="item.flowCardCode">
              {{ item.flowCardCode }}
            </a-option>
          </a-select>
        </a-form-item>
      </a-form>
    </a-modal>
    <a-modal v-model:visible="visible4" title="选择流转卡号信息" :width="1000" :draggable="true" @ok="handleOk2"
             @cancel="handleCancel2">
      <a-table :style="{ height: '100%', marginTop: '10px' }" row-key="formulaOdd"
               :row-selection="{ showCheckedAll: true, width: 50, onlyCurrent: true, type: 'radio' }" stripe
               :bordered="true" :scrollbar="true" :pagination="false" sticky-header :columns="tableColumns7"
               v-model:selected-keys="selectedRowKeys5" :data="cardList">
      </a-table>
    </a-modal>

    <!-- 拷贝配方单号 -->
    <a-modal v-model:visible="visible5" title="选择配方单号拷贝" :draggable="true" @ok="handleOk3"
             @cancel="handleCancel3">
      <a-form :model="dataForm" :label-col-props="{ span: 6 }" :wrapper-col-props="{ span: 18 }">
        <a-form-item label="配方单号">
          <a-select popup-container="html" class="bacClass" v-model="dataForm3.formulaOdd" @focus="focusSel10"
                    @search="handleSearch10"
                    :loading="loading9" allow-clear allow-search>
            <a-option v-for="item in pageData.oddList" :value="item.formulaOdd">
              {{ item.formulaOdd }}
            </a-option>
          </a-select>
        </a-form-item>
      </a-form>
    </a-modal>

    <!-- 打印正常单 -->
    <a-modal draggable :visible="visible6" @ok="handleOk6" @cancel="visible6 = false" okText="打印" cancelText="关闭"
             unmountOnClose :width=875>
      <template #title> 打印 配方单制作2022 正常单</template>
      <div id="Normal">
        <h1 style="width: 100%;text-align: center;">粤隆配方单</h1>
        <div style="margin-left:40px;width: 90%;">
          <span>打印时间:{{ pageData.nowTime }}</span>
          <svg id="barcode"></svg>
        </div>
        <div style="margin-top: 10px;margin-left:40px;width: 90%;margin-right: 20px;" v-for="item in idList">
          <span style="margin-right: 20px;">机台：{{ item.machineOdd }}</span>
          <span style="margin-right: 20px;">流转卡号：{{ item.flowCardCode }}</span>
          <span style="margin-right: 20px;">载量：{{ item.alwaysWeight }}</span>
          <span style="margin-right: 20px;">性质：{{ item.property }}</span>
          <span style="margin-right: 20px;">工艺时间：{{ item.craftDate }}</span>
        </div>
        <table class="isTable">
          <tr v-for="item in idList">
            <td :colspan="2">客户名称</td>
            <td>{{ item.customName }}</td>
            <td>机台管数</td>
            <td :colspan="4">{{ item.tubeType }}</td>
            <td>匹数</td>
            <td>{{ item.houseNum }}</td>
            <td>重量</td>
            <td :colspan="2">{{ item.gramWeight }}</td>
          </tr>
          <tr v-for="item in idList">
            <td :colspan="2">颜色</td>
            <td>{{ item.colourDepth }}</td>
            <td>吸水率</td>
            <td :colspan="4">{{ item.dyeWater }}</td>
            <td>主泵</td>
            <td>{{ item.mainPump }}</td>
            <td>风机</td>
            <td>{{ item.styles }}</td>
            <td>位置</td>
          </tr>
          <tr v-for="item in idList">
            <td :colspan="2">拼缸缸号</td>
            <td :colspan="6">{{ item.flowCardCodes }}</td>
            <td>布长</td>
            <td>{{ item.clothLength }}</td>
            <td>机速</td>
            <td>{{ item.machineSpeed }}</td>
            <td>{{ item.coordinate }}</td>
          </tr>
          <tr v-for="item in idList">
            <td :colspan="2">布类名称</td>
            <td :colspan="3">{{ item.productName }}</td>
            <td :colspan="2">备注</td>
            <td :colspan="6">{{ item.remark }}</td>
          </tr>
          <tr>
            <td>步骤</td>
            <td>调整</td>
            <td>用量</td>
            <td>染化料名称</td>
            <td>重量</td>
            <td>单位</td>
            <td>方式</td>
            <td :colspan="6">操作步骤</td>
          </tr>
          <tr v-for="item in idList">
            <th :colspan="2">{{ item.processName }}</th>
            <th>浴比 {{ item.bathRatioOne }}</th>
            <th>总水量 {{ item.waterYield }}</th>
            <th>副缸扣减量 {{ item.abatement }}</th>
            <th :colspan="2">盐扣减量 {{ item.abatementWater }}</th>
            <th :colspan="6">湿布进水量 {{ item.waterCloth }}</th>
          </tr>
          <tr v-for="item in idList2">
            <td :colspan="2" style="border:0px">{{ item.processCode }}</td>
            <td style="border:0px">{{ item.ingredient }} {{ item.conUnits }}</td>
            <td style="border:0px">{{ item.materialName }}</td>
            <td style="border:0px">{{ item.concentration }}</td>
            <td style="border:0px">{{ item.ingUnits }}</td>
            <td style="border:0px">{{ item.manuAuto === 0 ? '自动' : '手动' }}</td>
            <td :colspan="6" style="border:0px">{{ item.handleProcess }}</td>
          </tr>
        </table>
        <table class="isTable2">
          <tr v-for="item in idList">
            <td>开单：{{ item.createName }}</td>
            <td>开单日期：{{ item.createTime }}</td>
            <td>复核：</td>
            <td>称料：</td>
            <td>领料：</td>
          </tr>
        </table>
      </div>
    </a-modal>

    <!-- 打印加料单 -->
    <a-modal draggable :visible="visible7" @ok="handleOk7" @cancel="visible7 = false" okText="打印" cancelText="关闭"
             unmountOnClose :width=875>
      <template #title> 打印 配方单制作2022 加料单</template>
      <div id="Feeding">
        <h1 style="width: 100%;text-align: center;">粤隆配方单</h1>
        <div style="margin-left:40px;width: 90%;">
          <span>打印时间:{{ pageData.nowTime }}</span>
          <svg id="barcode"></svg>
        </div>
        <div style="margin-top: 10px;margin-left:40px;width: 90%;margin-right: 20px;" v-for="item in idList">
          <span style="margin-right: 30px;">机台：{{ item.machineOdd }}</span>
          <span style="margin-right: 30px;">机台：{{ item.flowCardCode }}</span>
          <span style="margin-right: 30px;">流转卡号：{{ item.flowCardCode }}</span>
          <span style="margin-right: 30px;">性质：{{ item.property }}</span>
        </div>
        <table class="isTable">
          <tr v-for="item in idList">
            <td :colspan="2">客户名称</td>
            <td>{{ item.customName }}</td>
            <td>颜色</td>
            <td :colspan="3">{{ item.colourDepth }}</td>
            <td>匹数</td>
            <td>{{ item.houseNum }}</td>
            <td>重量</td>
            <td>{{ item.gramWeight }}</td>
          </tr>
          <tr v-for="item in idList">
            <td :colspan="2">布类名称</td>
            <td :colspan="6" style="text-align: left;">{{ item.productName }}</td>
            <td>开单日期</td>
            <td :colspan="2">{{ item.createTime }}</td>
          </tr>
          <tr v-for="item in idList">
            <td>步骤</td>
            <td>调整</td>
            <td>用量</td>
            <td>染化料名称</td>
            <td>重量</td>
            <td>单位</td>
            <td>方式</td>
            <td :colspan="6">操作步骤</td>
          </tr>
          <tr v-for="item in idList">
            <th :colspan="2">{{ item.processName }}</th>
            <th>浴比 {{ item.bathRatioOne }}</th>
            <th>总水量 {{ item.waterYield }}</th>
            <th>副缸扣减量 {{ item.abatement }}</th>
            <th :colspan="2">盐扣减量 {{ item.abatementWater }}</th>
            <th :colspan="6">湿布进水量 {{ item.waterCloth }}</th>
          </tr>
          <tr v-for="item in idList2">
            <td :colspan="2" style="border:0px">{{ item.processCode }}</td>
            <td style="border:0px">{{ item.ingredient }} {{ item.conUnits }}</td>
            <td style="border:0px">{{ item.materialName }}</td>
            <td style="border:0px">{{ item.concentration }}</td>
            <td style="border:0px">{{ item.ingUnits }}</td>
            <td style="border:0px">{{ item.manuAuto === 0 ? '自动' : '手动' }}</td>
            <td :colspan="6" style="border:0px">{{ item.handleProcess }}</td>
          </tr>
        </table>
        <table class="isTable2">
          <tr v-for="item in idList">
            <td>开单：{{ item.createName }}</td>
            <td>复核：{{ item.createTime }}</td>
            <td>称料：</td>
            <td>领料：</td>
          </tr>
        </table>
      </div>
    </a-modal>

    <!-- 打印制作单 -->
    <a-modal draggable :visible="visible8" @ok="handleOk8" @cancel="visible8 = false" okText="打印" cancelText="关闭"
             unmountOnClose :width=875>
      <template #title> 打印配方单制单2022</template>
      <div id="Work">
        <div style="display:none">
          <svg id="barcode"></svg>
        </div>
        <div style="width:100%;">
          <table class="isTable" style="margin-top:20px;">
            <tr>
              <td :colspan="4">头缸染色</td>
            </tr>
            <tr v-for="item in idList">
              <td>主泵</td>
              <td>{{ item.mainPump }}</td>
              <td>机速</td>
              <td>{{ item.machineSpeed }}</td>
            </tr>
            <tr v-for="item in idList">
              <td>风机</td>
              <td>{{ item.styles }}</td>
              <td>喷嘴</td>
              <td>{{ item.nozzle }}</td>
            </tr>
          </table>
          <table class="isTable" style="margin-top:10px;">
            <tr>
              <td :colspan="4">行机参数记录</td>
            </tr>
            <tr>
              <td></td>
              <td>前处理</td>
              <td>染色</td>
              <td>后处理</td>
            </tr>
            <tr>
              <td>风机</td>
              <td v-for="item in idList3">{{ item.styles }}</td>
              <td v-for="item in idList4">{{ item.styles }}</td>
              <td v-for="item in idList5">{{ item.styles }}</td>
            </tr>
            <tr>
              <td>主泵</td>
              <td v-for="item in idList3">{{ item.mainPump }}</td>
              <td v-for="item in idList4">{{ item.mainPump }}</td>
              <td v-for="item in idList5">{{ item.mainPump }}</td>
            </tr>
            <tr>
              <td>机速</td>
              <td v-for="item in idList3">{{ item.machineSpeed }}</td>
              <td v-for="item in idList4">{{ item.machineSpeed }}</td>
              <td v-for="item in idList5">{{ item.machineSpeed }}</td>
            </tr>
            <tr>
              <td>喷嘴</td>
              <td v-for="item in idList3">{{ item.nozzle }}</td>
              <td v-for="item in idList4">{{ item.nozzle }}</td>
              <td v-for="item in idList5">{{ item.nozzle }}</td>
            </tr>
            <tr>
              <td>圈时</td>
              <td></td>
              <td></td>
              <td></td>
            </tr>
            <tr>
              <td>签名</td>
              <td></td>
              <td></td>
              <td></td>
            </tr>
          </table>
          <table class="isTable" style="margin-top:10px;">
            <tr>
              <td>染前PH</td>
              <td style="width:250px;"></td>
              <td :rowspan="5">含氧量贴样</td>
            </tr>
            <tr>
              <td>含氧量</td>
              <td></td>
            </tr>
            <tr>
              <td>染色水量</td>
              <td></td>
            </tr>
            <tr>
              <td>进水前读数</td>
              <td></td>
            </tr>
            <tr>
              <td>进水后读数</td>
              <td></td>
            </tr>
          </table>
        </div>
        <div style="margin-top:15px;">
          <div style="width:100%;">
            <table class="isTable3">
              <tr>
                <td>
                  <span style="margin-right: 10px;">步骤 调整</span>
                  <span>用量</span>
                </td>
                <td>染化料名称</td>
                <td>
                  <span style="margin-right: 10px;">重量</span>
                  <span>单位</span>
                </td>
                <td>操作步骤</td>
              </tr>
              <table v-for="item in idList2">
                <tr>
                  <td>{{ item.processName }}</td>
                  <td>
                    <span style="margin-right: 17px;">浴比 {{ item.bathRatioOne }}</span>
                    <span style="margin-right: 17px;">总水量 {{ item.waterYield }}</span>
                  </td>
                  <td style="margin-right: 20px;">副缸扣减量 {{ item.abatement }}</td>
                  <td>
                    <span style="margin-right: 15px;">盐扣减量 {{ item.abatementWater }}</span>
                    <span>湿布进水量 {{ item.waterCloth }}</span>
                  </td>
                </tr>
                <tr>
                  <th>
                    <span>{{ item.processCode }}</span>
                    <span style="margin-left: 45px;">{{ item.ingredient }}</span>
                  </th>
                  <td>{{ item.materialName }}</td>
                  <th>
                    <span style="margin-right: 10px;">{{ item.concentration }}</span>
                    <span>{{ item.ingUnits }}</span>
                  </th>
                  <td>{{ item.handleProcess }}</td>
                </tr>
              </table>
            </table>
          </div>
        </div>
      </div>
    </a-modal>
  </pageTabelLayout>
</template>

<script lang="ts">
import {post} from '@/api/http'
import {useTable, useRowKey, useTableColumn, usePagination, useRowSelection} from '@/hooks/table';
import {ref, reactive, onMounted, toRefs} from 'vue'
import Toolbar from '@/components/Toolbar.vue';
import {Form, Message, Modal} from '@arco-design/web-vue';
import {FormInstance} from '@arco-design/web-vue/es/form';
import {baseURL} from '../../../../api/axios.config'
import axios from "axios";
import filedownload from 'js-file-download'
import usePermission from '@/store/modules/permission'
import PageTabelLayout from '@/components/pageTabelLayout.vue';
import {AnyARecord} from 'dns';

import {localeText} from '@/api/aggridZw'
import {pagingList} from '@/api/paging'
import dayjs from "dayjs";
import moment from "moment";
import {tableColumnsTooltipFieId} from '@/utils/tableColumnsTooltipFieId';
import emitter from "@/hooks/useEventBus";
import printJS from 'print-js'
import JsBarcode from 'jsbarcode'
import {saveOrUpdateGridState as saveOrUpdateGridState01} from '@/hooks/useGridState'

interface BrandInfo {
  "id": any,
  "remark": string | undefined,
  "createName": string | undefined,
  "createTime": string | undefined,
  "updateName": string | undefined,
  "updateTime": string | undefined,
  "formulaOdd": any,
  "obsoleteState": any,
  "serial": any,
  "programType": any,
  "daysProofing": any,
  "property": any,
  "jobType": any,
  "flowCardCode": any,
  "dyelotNumber": any,
  "customName": any,
  "colorCode": any,
  "colorName": any,
  "affirmColour": any,
  "houseNum": any,
  "alwaysWeight": any,
  "machineOdd": any,
  "greyCode": any,
  "productName": any,
  "yarnBatch": any,
  "affirmColourName": any,
  "documenter": any,
  "auditName": any,
  "auditDate": any,
  "planOrderCode": any,
  "authorizedDate": any,
  "types": any,
  "bathRatio": any,
  "efficacious": any,
  "gramWeight": any,
  "colourDepth": any,
  "propertyStater": any,
}

export default {
  name: "TrackingNumbersDetails",
  setup() {
    const total = ref(10);
    const page = ref(1);
    const size = ref(10);

    function PageSize(val: any) {
      page.value = val
      doRefresh();
    }

    function change1(val: any) {
      size.value = val
      doRefresh();
    }

    const headerShow = ref<boolean>(true)

    //查询方法
    function doRefresh() {
      pageData.pageLoading = true
      // updateGridState01()
      post({
        url: "/pdm/CrockCalorie/getInfo",
        data: {
          page: page.value,
          size: size.value,
          deleteState: 0,
          authorizedDate: pageData.authorizedDate,
          formulaOdd: pageData.formulaOdd,
          flowCardCode: pageData.flowCardCode,
          planOrderCode: pageData.planOrderCode,
          property: pageData.property,
          greyCode: pageData.greyCode,
          productName: pageData.productName,
        },
      })
          .then(({data, code, message}: any) => {
            if (code === 200) {
              table.handleSuccess(data.list);
              gridOption.value.setRowData(data.list);
              total.value = data.total;
            } else {
              Message.error(message)
            }
          })
          .catch(console.log).finally(() => {
        pageData.pageLoading = false
      })
    }

    const {selectedRowKeys, onSelectionChange} = useRowSelection();
    const pagination = usePagination(doRefresh);
    const table = useTable();
    const rowKey = useRowKey("id");

    //浴比
    const tableColumns1 = useTableColumn([
      {
        title: "项目",
        key: "project",
        dataIndex: "project",
        slotName: "project",
        width: 120
      },
      {
        title: '程序号',
        key: 'programNumber',
        dataIndex: "programNumber",
        slotName: "programNumber",
        width: 120
      },
      {
        title: '浴比',
        key: 'bathRatioOne',
        dataIndex: "bathRatioOne",
        slotName: "bathRatioOne",
        width: 120
      },
      {
        title: '浴比1',
        key: 'bathRatio',
        dataIndex: "bathRatio",
        slotName: "bathRatio",
        width: 120
      },
      {
        title: '副缸扣减量',
        key: 'assistantVatMinWater',
        dataIndex: "assistantVatMinWater",
        slotName: "assistantVatMinWater",
        width: 120
      },
      {
        title: '盐扣减水量',
        key: 'saltWater',
        dataIndex: "saltWater",
        slotName: "saltWater",
        width: 120
      },
    ]);

    //拼缸信息
    const tableColumns2 = useTableColumn([
      {
        title: "流转卡号",
        key: "flowCardCode",
        dataIndex: "flowCardCode",
        slotName: "flowCardCode",
        width: 120,
      },
      {
        title: "匹数",
        key: "loneNumber",
        dataIndex: "loneNumber",
        slotName: "loneNumber",
        width: 120
      },
      {
        title: "重量",
        key: "byPieceGramWeight",
        dataIndex: "byPieceGramWeight",
        slotName: "byPieceGramWeight",
        width: 120
      },
      {
        title: "品名",
        key: "gradeName",
        dataIndex: "gradeName",
        slotName: "gradeName",
        width: 120
      }
    ]);

    //程序号列表
    const tableColumns3 = useTableColumn([
      {
        title: "操作",
        key: "del",
        dataIndex: "del",
        slotName: 'del',
        width: 80,
      },
      {
        title: "工序名称",
        key: "dyeProcessName",
        dataIndex: "dyeProcessName",
        slotName: "dyeProcessName",
        width: 140,
      },
      {
        title: "程序号",
        key: "programNumber",
        dataIndex: "programNumber",
        slotName: "programNumber",
        width: 140
      },
      {
        title: "程序名称",
        key: "programName",
        dataIndex: "programName",
        slotName: "programName",
        width: 140
      },
      {
        title: "步骤号",
        key: "thickenerStep",
        dataIndex: "thickenerStep",
        slotName: "thickenerStep",
        width: 140
      },
      {
        title: "染化料编号",
        key: "materialCode",
        dataIndex: "materialCode",
        slotName: "materialCode",
        width: 140
      },
      {
        title: "染化料名称",
        key: "materialName",
        dataIndex: "materialName",
        slotName: "materialName",
        width: 140
      },
      {
        title: "类别",
        key: "category",
        dataIndex: "category",
        slotName: "category",
        width: 140
      },
      {
        title: "调整比例%",
        key: "percentage",
        dataIndex: "percentage",
        slotName: "percentage",
        width: 140
      },
      {
        title: "浴比",
        key: "bathRatio",
        dataIndex: "bathRatio",
        slotName: "bathRatio",
        width: 140
      },
      {
        title: "水量",
        key: "waterYield",
        dataIndex: "waterYield",
        slotName: "waterYield",
        width: 140
      },
      {
        title: "总浓度",
        key: "alwaysConcentration",
        dataIndex: "alwaysConcentration",
        slotName: "alwaysConcentration",
        width: 140
      },
      {
        title: "用料比例",
        key: "materialRatio",
        dataIndex: "materialRatio",
        slotName: "materialRatio",
        width: 140
      },
      {
        title: "浓度",
        key: "concentration",
        dataIndex: "concentration",
        slotName: "concentration",
        width: 140
      },
      {
        title: "浓度单位",
        key: "concentrationUnit",
        dataIndex: "concentrationUnit",
        slotName: "concentrationUnit",
        width: 140
      },
      {
        title: "用料",
        key: "material",
        dataIndex: "material",
        slotName: "material",
        width: 140
      },
      {
        title: "单位",
        key: "unit",
        dataIndex: "unit",
        slotName: "unit",
        width: 140
      },
      {
        title: "操作步骤",
        key: "operatingSteps",
        dataIndex: "operatingSteps",
        slotName: "operatingSteps",
        width: 140
      },
      {
        title: "自动手动",
        key: "automanual",
        dataIndex: "automanual",
        slotName: "automanual",
        width: 140
      },
      {
        title: "副缸扣减量",
        key: "assistantVatMinWater",
        dataIndex: "assistantVatMinWater",
        slotName: "assistantVatMinWater",
        width: 140
      },
      {
        title: "盐扣减水量",
        key: "saltWater",
        dataIndex: "saltWater",
        slotName: "saltWater",
        width: 140
      },
      {
        title: "浓度最大限制G/L",
        key: "MaxLimit",
        dataIndex: "MaxLimit",
        slotName: "MaxLimit",
        width: 140
      },
      {
        title: "染料批号",
        key: "batchNumber",
        dataIndex: "batchNumber",
        slotName: "batchNumber",
        width: 140
      },
      {
        title: "调整系数",
        key: "adjust",
        dataIndex: "adjust",
        slotName: "adjust",
        width: 140
      },
      // {
      //     title: "工艺步骤",
      //     key: "processingStep",
      //     dataIndex: "processingStep",
      //     slotName: "processingStep",
      //     width: 140
      // },
      // {
      //     title: "顺序号",
      //     key: "null",
      //     dataIndex: "null",
      //     slotName: "null",
      //     width: 140
      // },
      {
        title: "原料类型",
        key: "materialType",
        dataIndex: "materialType",
        slotName: "materialType",
        width: 140
      },
      {
        title: "化料桶号",
        key: "chargingBasket",
        dataIndex: "chargingBasket",
        slotName: "chargingBasket",
        width: 140
      },
      // {
      //     title: "化料程序",
      //     key: "null2",
      //     dataIndex: "null2",
      //     slotName: "null2",
      //     width: 140
      // },
      // {
      //     title: "类型",
      //     key: "subClassName",
      //     dataIndex: "subClassName",
      //     slotName: "subClassName",
      //     width: 140
      // },
      {
        title: "浴比",
        key: "bathRatioOne",
        dataIndex: "bathRatioOne",
        slotName: "bathRatioOne",
        width: 140
      },
      {
        title: "输送方式",
        key: "meansDelivery",
        dataIndex: "meansDelivery",
        slotName: "meansDelivery",
        width: 140
      }
    ]);

    //选择程序号信息
    const tableColumns4 = useTableColumn([
      {
        title: "程序号",
        key: "programNumber",
        dataIndex: "programNumber",
        slotName: "programNumber",
        width: 150
      },
      {
        title: "程序名称",
        key: "programName",
        dataIndex: "programName",
        slotName: "programName",
        width: 150
      },
      {
        title: "程序类型",
        key: "programType",
        dataIndex: "programType",
        slotName: "programType",
        width: 150
      },
    ]);

    //配方单列表
    const tableColumns5 = useTableColumn([
      {
        title: "配方单号",
        key: "formulaOdd",
        dataIndex: "formulaOdd",
        width: 150,
      },
      {
        title: "性质",
        key: "property",
        dataIndex: "property",
        width: 150
      },
      {
        title: "作业类型",
        key: "jobType",
        dataIndex: "jobType",
        width: 150
      },
      {
        title: "流程卡号",
        key: "flowCardCode",
        dataIndex: "flowCardCode",
        width: 150
      },
      {
        title: "计划单号",
        key: "planOrderCode",
        dataIndex: "planOrderCode",
        width: 150
      },
      {
        title: "拼缸缸号",
        key: "dyelotNumber",
        dataIndex: "dyelotNumber",
        width: 200
      },
      {
        title: "色号",
        key: "colorCode",
        dataIndex: "colorCode",
        width: 150
      },
      {
        title: "色称",
        key: "colorName",
        dataIndex: "colorName",
        width: 200
      },
      {
        title: "确认色",
        key: "affirmColour",
        dataIndex: "affirmColour",
        width: 200
      },
      {
        title: "客户名称",
        key: "customName",
        dataIndex: "customName",
        width: 200
      },
      {
        title: "匹数",
        key: "houseNum",
        dataIndex: "houseNum",
        width: 200
      },
      {
        title: "重量",
        key: "alwaysWeight",
        dataIndex: "alwaysWeight",
        width: 200
      },
      {
        title: "设备编号",
        key: "machineOdd",
        dataIndex: "machineOdd",
        width: 200
      },
      {
        title: "布号",
        key: "greyCode",
        dataIndex: "greyCode",
        width: 200
      },
      {
        title: "品名",
        key: "productName",
        dataIndex: "productName",
        width: 200
      },
      {
        title: "纱批",
        key: "yarnBatch",
        dataIndex: "yarnBatch",
        width: 200
      },
      {
        title: "资料员",
        key: "documenter",
        dataIndex: "documenter",
        width: 200
      },
      {
        title: "中控审核时间",
        key: "`auditDate`",
        dataIndex: "auditDate",
        width: 200
      },
      {
        title: "中控审核人",
        key: "auditName",
        dataIndex: "auditName",
        width: 200
      },
      {
        title: "对色师傅",
        key: "affirmColourName",
        dataIndex: "affirmColourName",
        width: 200
      },
      {
        title: '导入状态',
        key: "leadState",
        dataIndex: "leadState",
        slotName: 'leadState',
        width: 150,
        fixed: 'right'
      },
      {
        title: '操作',
        key: "action",
        dataIndex: "action",
        slotName: 'action',
        width: 150,
        fixed: 'right'
      }
    ]);

    //配方单明细
    const tableColumns6 = useTableColumn([
      {
        title: "染色工序名称",
        key: "processName",
        dataIndex: "processName",
        width: 150,
      },
      {
        title: "程序号",
        key: "programNumber",
        dataIndex: "programNumber",
        width: 150
      },
      {
        title: "程序名称",
        key: "programName",
        dataIndex: "programName",
        width: 150
      },
      {
        title: "染化料编号",
        key: "materialCode",
        dataIndex: "materialCode",
        width: 150
      },
      {
        title: "染化料名称",
        key: "materialName",
        dataIndex: "materialName",
        width: 150
      },
      {
        title: "染化料类别",
        key: "materialType",
        dataIndex: "materialType",
        width: 200
      },
      {
        title: "浓度单位",
        key: "conUnits",
        dataIndex: "conUnits",
        width: 150
      },
      {
        title: "用料",
        key: "ingredient",
        dataIndex: "ingredient",
        width: 200
      },
      {
        title: "出库状态",
        key: "affirmColour",
        dataIndex: "affirmColour",
        width: 200
      },
      {
        title: "出库单号",
        key: "customName",
        dataIndex: "customName",
        width: 200
      }
    ]);

    //拷贝配方单信息
    const tableColumns7 = useTableColumn([
      {
        title: "配方单号",
        key: "formulaOdd",
        dataIndex: "formulaOdd",
        slotName: "formulaOdd",
        width: 150,
      },
      {
        title: "编制日期",
        key: "authorizedDate",
        dataIndex: "authorizedDate",
        slotName: "authorizedDate",
        width: 150
      },
      {
        title: "性质",
        key: "property",
        dataIndex: "property",
        slotName: "property",
        width: 150
      },
      {
        title: "流转卡号",
        key: "flowCardCode",
        dataIndex: "flowCardCode",
        slotName: "flowCardCode",
        width: 150
      }
    ]);

    let tc: any[] = tableColumns5.map((o) => {
      let obj = {
        headerName: o.title,
        field: o.key,
        pinned: o['fixed']
      }
      obj['width'] = 160
      if (o.slotName === 'action') {
        obj['resizable'] = false
        obj['filter'] = false
        obj['sortable'] = false
        obj["lockPosition"] = "right"
        obj['width'] = 111
        obj['cellRenderer'] = {
          template: `
            <a-space size="medium">
              <el-button style="color:#165dff;" link v-if="isData.auditState == 0" @click="a1">修改</el-button>
              <el-button link v-if="isData.auditState != 0" disabled>修改</el-button>
              <el-button style="color:#165dff;" link @click="a2">详情</el-button>
            </a-space>`,
          setup(props: any) {
            const isData = ref(props.params.data)
            const a1 = () => {
              editHandler(props.params.data)
            }
            const a2 = () => {
              cxDetails(props.params.data)
            }
            return {
              isData,
              a1,
              a2
            }
          }
        }
      }
      if (o.slotName === 'leadState') {
        obj["lockPosition"] = "right"
        obj['width'] = 120
        obj['cellRenderer'] = {
          template: `
            <el-tag v-if="isData.leadState == 0 && isData.auditState == 0" type="warning">未导入中控</el-tag>
            <el-tag v-if="isData.leadState == 1 && isData.auditState == 0" type="success">已调入中控</el-tag>
            <el-tag v-if="isData.leadState == 1 && isData.auditState == 1" type="info">中控已审核</el-tag>`,
          setup(props: any) {
            const isData = ref(props.params.data)
            return {
              isData,
            }
          }
        }
      }
      return obj
    })

    let tc2: any[] = tableColumns6.map((o) => {
      let obj = {
        headerName: o.title,
        field: o.key,
        pinned: o['fixed']
      }
      return obj
    })

    let a = [{
      showRowGroup: 'hide_def',
      "headerName": "",
      "checkboxSelection": true,
      "headerCheckboxSelection": true,
      "pinned": "left",
      "width": 50,
      resizable: false,
      filter: false,
      sortable: false,
      minWidth: 50,
      maxWidth: 50,
      lockPosition: "left",
    }]
    tc = a.concat(tc)
    tc2 = a.concat(tc2)


    const pageData = reactive<{
      showAdd: boolean,
      sideTitle: string,
      dropDownData: any,
      nameList: [],
      pageLoading: boolean,
      pfList: any[],
      dropDownData1: any,
      rHeight: any,
      btnList: any[],
      isEdit: boolean,
      dcList: any[],
      authorizedDate: any,
      formulaOdd: any,
      flowCardCode: any,
      planOrderCode: any,
      property: any,
      greyCode: any,
      productName: any,
      isDetailsList: any[],
      formulaOddId: any,
      lzList: any[],
      jhList: any[],
      zyList: any[],
      xzList: any[],
      bhList: any[],
      pmList: any[],
      cardList: any[],
      cardList2: any[],
      dsList: any[],
      zlList: any[],
      Crafts: any[],
      tanks: any[],
      machineList: any[],
      fyList: any[],
      jsList: any[],
      fjList: any[],
      pzList: any[],
      zbList: any[],
      oddList: any[],
      nowTime: any,
    }>({
      nameList: [],
      showAdd: false,
      sideTitle: '新增配方单号',
      dropDownData: "",
      pageLoading: false,
      pfList: [],
      dropDownData1: "",
      rHeight: 0,
      btnList: [],
      isEdit: false,
      dcList: [],
      authorizedDate: "",
      formulaOdd: "",
      flowCardCode: "",
      planOrderCode: "",
      property: "",
      greyCode: "",
      productName: "",
      isDetailsList: [],
      formulaOddId: null,
      lzList: [],
      jhList: [],
      zyList: [],
      xzList: [],
      bhList: [],
      pmList: [],
      cardList: [],
      cardList2: [],
      dsList: [],
      zlList: [],
      Crafts: [],
      tanks: [],
      machineList: [],
      fyList: [],
      jsList: [],
      fjList: [],
      pzList: [],
      zbList: [],
      oddList: [],
      nowTime: "",
    });

    //新增输入框 下拉框
    const dataForm2 = reactive<{
      "checker": any,
      "machineSpeed": any,
      "styles": any,
      "nozzle": any,
      "mainPump": any,
      "washWeight": any,
      "efficacious": any,
      "gramWeight": any,
      "colourDepth": any,
      "clothLength": any,
      "numbers": any,
      "assistantWater": any,
      "craftDate": any,
      "dyeWater": any,
      "waterAbsorption": any,
      "rowCloth": any,
      "flowCardCodes": any,
      "id": any,
      "remark": any,
    }>({
      "checker": "",
      "machineSpeed": "",
      "styles": "",
      "nozzle": "",
      "mainPump": "",
      "washWeight": null,
      "efficacious": "",
      "gramWeight": null,
      "colourDepth": "",
      "clothLength": "",
      "numbers": null,
      "assistantWater": null,
      "craftDate": null,
      "dyeWater": null,
      "waterAbsorption": null,
      "rowCloth": "",
      "flowCardCodes": "",
      "id": null,
      "remark": "",
    });

    //拷贝单号卡号 下拉框
    const dataForm3 = reactive<{
      "flowCardCode": any,
      "formulaOdd": any,
    }>({
      "flowCardCode": "",
      "formulaOdd": "",
    });

    onMounted(() => {
      // 切换tap到本页面执行的方法
      emitter.on("TrackingNumbersDetails", () => {
        // selCxAll({});
        doRefresh();
      });
      pageData.rHeight = document.getElementsByClassName("arco-tabs-content")[0]?.clientHeight
      //弹出层的高
      if (pageData.rHeight !== undefined) {
        pageData.rHeight = pageData.rHeight + 33;
      }
      window.addEventListener('resize', () => {
        pageData.rHeight = document.getElementsByClassName("arco-tabs-content")[0]?.clientHeight
        //弹出层的高
        if (pageData.rHeight !== undefined) {
          pageData.rHeight = pageData.rHeight + 33;
        }

      })
    });

    //查询
    const selectHandler = () => {
      page.value
      doRefresh();
    }

    //新增
    let id = ref(1);
    const addHandler = () => {
      for (var key in dataForm) {
        if (key === "id") {
          dataForm[key] = null;
        } else {
          dataForm[key] = "";
        }
      }
      for (var key in dataForm2) {
        if (key === "id") {
          dataForm2[key] = null;
        } else if (key === "assistantWater") {
          dataForm2[key] = 0;
        } else {
          dataForm2[key] = '';
        }
      }
      console.log(dataForm2.assistantWater)
      Programs.value = []
      Crafts.value = []
      Tanks.value = []

      pageData.isEdit = false
      pageData.showAdd = true
      pageData.sideTitle = '新增配方单号'
      post({
        url: "/pdm/CrockCalorie/getbh",
        data: [{}]
      }).then(({data, code}: any) => {
        if (code == 200) {
          dataForm.formulaOdd = data.maxApplyCode
        }
      })
    }

    const dataForm = reactive<BrandInfo>({
      "id": null,
      "remark": "",
      "createName": "",
      "createTime": "",
      "updateName": "",
      "updateTime": "",
      "formulaOdd": "",
      "obsoleteState": "",
      "serial": 0,
      "programType": null,
      "daysProofing": "",
      "property": "",
      "jobType": "",
      "flowCardCode": "",
      "dyelotNumber": "",
      "customName": "",
      "colorCode": "",
      "colorName": "",
      "affirmColour": "",
      "houseNum": "",
      "alwaysWeight": "",
      "machineOdd": "",
      "greyCode": "",
      "productName": "",
      "yarnBatch": "",
      "affirmColourName": "",
      "documenter": "",
      "auditName": "",
      "auditDate": "",
      "planOrderCode": "",
      "authorizedDate": "",
      "types": "",
      "bathRatio": null,
      "efficacious": "",
      "gramWeight": "",
      "colourDepth": "",
      "propertyStater": null,

    })

    // 表格准备事件
    const gridOption = ref()
    const colState = ref()
    const gridReady = (params: any) => {
      gridOption.value = params.api
      colState.value = params.columnApi
    }

    //查看详情按钮
    const visible1 = ref(false);
    const cxDetails = (record: any) => {
      visible1.value = true
      post({
        url: "/pdm/CrockCalorieDetail/selectPage",
        data: {
          page: 1,
          size: pagination.pageSize,
          crockCalorieID: record.id
        }
      }).then(({data, code}: any) => {
        if (code == 200) {
          pageData.isDetailsList = data.list
        } else {
          Message.error({
            content: "查询失败！",
            duration: 5000,
          });
        }
      })
    }

    const formRef = ref<FormInstance>()
    const sideOk = () => {
      pageData.pageLoading = true;
      for (let i = 0; i < Programs.value.length; i++) {
        if (Programs.value[i].alwaysConcentration == null) {
          Message.error('总浓度不能为空!')
          return false
        }
        if (Programs.value[i].materialRatio == '') {
          Message.error('用料比例不能为空!')
          return false
        }
      }
      if (Programs.value === 0) {
        Message.error('请添加程序号!')
        return
      }
      if (Crafts.value === 0) {
        Message.error('请计算浴比!')
        return
      }

      if (pageData.sideTitle === "新增配方单号") {
        let list = []
        for (let i = 0; i < Programs.value.length; i++) {
          var ob = {}
          ob['processName'] = Programs.value[i].dyeProcessName
          ob['programNumber'] = Programs.value[i].programNumber
          ob['programName'] = Programs.value[i].programName
          ob['processCode'] = Programs.value[i].thickenerStep
          ob['materialCode'] = Programs.value[i].materialCode
          ob['materialName'] = Programs.value[i].materialName
          ob['category'] = Programs.value[i].category
          ob['percentage'] = Programs.value[i].percentage
          ob['bathRatioOne'] = Programs.value[i].bathRatio
          ob['waterYield'] = Programs.value[i].waterYield
          ob['alwaysConcentration'] = Programs.value[i].alwaysConcentration
          ob['proportion'] = Programs.value[i].materialRatio
          ob['concentration'] = Programs.value[i].concentration
          ob['conUnits'] = Programs.value[i].concentrationUnit
          ob['ingredient'] = Programs.value[i].material
          ob['ingUnits'] = Programs.value[i].unit
          ob['handleProcess'] = Programs.value[i].operatingSteps
          ob['manuAuto'] = Programs.value[i].automanual
          ob['abatement'] = Programs.value[i].assistantVatMinWater
          ob['abatementWater'] = Programs.value[i].saltWater
          ob['maxConcentration'] = Programs.value[i].MaxLimit
          ob['batchNumber'] = Programs.value[i].batchNumber
          ob['adjust'] = Programs.value[i].adjust
          ob['materialType'] = Programs.value[i].materialType
          ob['pailCode'] = Programs.value[i].chargingBasket
          ob['bathRatioTwo'] = Programs.value[i].bathRatioOne
          ob['convey'] = Programs.value[i].meansDelivery
          list.push(ob)
        }
        post({
          url: "/pdm/CrockCalorie/insertMap",
          data: {
            CrockCalorie: dataForm,
            CrockCalorieDetail: list,
            TransitShipment: Crafts.value,
            ElsesMessage: dataForm2,
            // SpellCrock: ""
          }
        }).then((res: any) => {
          if (res.code === 200) {
            formRef.value?.resetFields();
            pageData.showAdd = false;
            Message.success({
              content: "新增成功",
              duration: 5000,
            });
          } else {
            Message.error({
              content: res.message,
              duration: 5000,
            });
          }
          doRefresh();
        }).finally(() => {
          doRefresh();
          pageData.pageLoading = false
        })
      } else {
        let list = []
        for (let i = 0; i < Programs.value.length; i++) {
          var ob = {}
          ob['id'] = Programs.value[i].id
          ob['processName'] = Programs.value[i].dyeProcessName
          ob['programNumber'] = Programs.value[i].programNumber
          ob['programName'] = Programs.value[i].programName
          ob['processCode'] = Programs.value[i].thickenerStep
          ob['materialCode'] = Programs.value[i].materialCode
          ob['materialName'] = Programs.value[i].materialName
          ob['category'] = Programs.value[i].category
          ob['percentage'] = Programs.value[i].percentage
          ob['bathRatioOne'] = Programs.value[i].bathRatio
          ob['waterYield'] = Programs.value[i].waterYield
          ob['alwaysConcentration'] = Programs.value[i].alwaysConcentration
          ob['proportion'] = Programs.value[i].materialRatio
          ob['concentration'] = Programs.value[i].concentration
          ob['conUnits'] = Programs.value[i].concentrationUnit
          ob['ingredient'] = Programs.value[i].material
          ob['ingUnits'] = Programs.value[i].unit
          ob['handleProcess'] = Programs.value[i].operatingSteps
          ob['manuAuto'] = Programs.value[i].automanual
          ob['abatement'] = Programs.value[i].assistantVatMinWater
          ob['abatementWater'] = Programs.value[i].saltWater
          ob['maxConcentration'] = Programs.value[i].MaxLimit
          ob['batchNumber'] = Programs.value[i].batchNumber
          ob['adjust'] = Programs.value[i].adjust
          ob['materialType'] = Programs.value[i].materialType
          ob['pailCode'] = Programs.value[i].chargingBasket
          ob['bathRatioTwo'] = Programs.value[i].bathRatioOne
          ob['convey'] = Programs.value[i].meansDelivery
          list.push(ob)
        }
        post({
          url: "/pdm/CrockCalorieDetail/update",
          data: {
            CrockCalorieDetail: list,
            TransitShipment: Crafts.value,
            ElsesMessage: dataForm2,
            // SpellCrock: ""
          },
        }).then((res: any) => {
          if (res.code === 200) {
            formRef.value?.resetFields();
            pageData.showAdd = false;
            Message.success({
              content: "修改成功",
              duration: 5000,
            });
          } else {
            Message.error({
              content: res.message,
              duration: 5000,
            });
          }
        }).finally(() => {
          doRefresh();
          pageData.pageLoading = false
        })
      }
    }

    const deleteHandler = () => {
      if (gridOption.value.getSelectedRows().length === 0) {
        Message.error('请先勾选')
        return
      }
      Modal.confirm({
        title: '系统提示',
        content: '确认删除选中的数据?',
        onOk() {
          pageData.pageLoading = true;
          post({
            url: '/pdm/ProgramType/delete',
            data: gridOption.value.getSelectedRows().map((o: any) => {
              return o.id
            })
          }).then(({code}: any) => {
            if (code === 200) {
              Message.success({
                content: '删除成功',
                duration: 5000
              })
              pagination.page = 1
              doRefresh()
            } else {
              Message.error({
                content: '修改失败',
                duration: 5000
              })
            }
          }).finally(() => {
            pageData.pageLoading = false
          });
        }
      })
    }
    const editHandler = (record: any) => {
      //循环对象 赋值
      for (let key in record) {
        dataForm[key] = record[key]
      }
      dataForm2.id = record.eid
      dataForm2.checker = record.checker
      dataForm2.machineSpeed = record.machineSpeed
      dataForm2.styles = record.styles
      dataForm2.nozzle = record.nozzle
      dataForm2.mainPump = record.mainPump
      dataForm2.washWeight = record.washWeight
      dataForm2.efficacious = record.efficacious
      dataForm2.gramWeight = record.gramWeight
      dataForm2.colourDepth = record.colourDepth
      dataForm2.clothLength = record.clothLength
      dataForm2.numbers = record.numbers
      dataForm2.assistantWater = record.assistantWater
      dataForm2.craftDate = record.craftDate
      dataForm2.dyeWater = record.dyeWater
      dataForm2.waterAbsorption = record.waterAbsorption
      dataForm2.rowCloth = record.rowCloth
      dataForm2.flowCardCodes = record.flowCardCodes
      dataForm2.remark = record.remark
      post({
        url: "/pdm/CrockCalorie/selectMap",
        data: {
          formulaOdd: record.formulaOdd,
          deteleState: 0,
        }
      }).then(({code, data}: any) => {
        if (code == 200) {
          //拼缸信息
          dataForm.propertyStater = data.CrockCalorie.propertyStater
          //程序号信息
          Programs.value = data.CrockCalorieDetail
          for (let i = 0; i < Programs.value.length; i++) {
            for (let j = 0; j < data.CrockCalorieDetail.length; j++) {
              if (Programs.value[i].id == data.CrockCalorieDetail[j].id) {
                Programs.value[i].id = data.CrockCalorieDetail[j].id
                Programs.value[i].dyeProcessName = data.CrockCalorieDetail[j].processName
                Programs.value[i].thickenerStep = data.CrockCalorieDetail[j].processCode
                Programs.value[i].bathRatio = data.CrockCalorieDetail[j].bathRatioOne
                Programs.value[i].materialRatio = data.CrockCalorieDetail[j].proportion
                Programs.value[i].concentrationUnit = data.CrockCalorieDetail[j].conUnits
                Programs.value[i].material = data.CrockCalorieDetail[j].ingredient
                Programs.value[i].unit = data.CrockCalorieDetail[j].ingUnits
                Programs.value[i].operatingSteps = data.CrockCalorieDetail[j].handleProcess
                Programs.value[i].automanual = data.CrockCalorieDetail[j].manuAuto
                Programs.value[i].assistantVatMinWater = data.CrockCalorieDetail[j].abatement
                Programs.value[i].saltWater = data.CrockCalorieDetail[j].abatementWater
                Programs.value[i].MaxLimit = data.CrockCalorieDetail[j].maxConcentration
                Programs.value[i].chargingBasket = data.CrockCalorieDetail[j].pailCode
                Programs.value[i].bathRatioOne = data.CrockCalorieDetail[j].bathRatioTwo
                Programs.value[i].meansDelivery = data.CrockCalorieDetail[j].convey
              }
            }
          }
          //拼缸信息
          Crafts.value = data.TransitShipment
          for (let i = 0; i < Crafts.value.length; i++) {
            for (let j = 0; j < data.TransitShipment.length; j++) {
              if (Crafts.value[i].id == data.TransitShipment[j].id) {
                Crafts.value[i].bathRatio = data.TransitShipment[j].bathRatioTwo
                Crafts.value[i].assistantVatMinWater = data.TransitShipment[j].abatementWater
                Crafts.value[i].saltWater = data.TransitShipment[j].abatement
              }
            }
          }
        }
      })
      pageData.isEdit = true
      pageData.sideTitle = '修改配方单号'
      pageData.showAdd = true
    }
    const handleChange = (_data: any) => {
      table.handleSuccess(_data);
    }
    const defaultColDef = {
      sortable: true,
      resizable: true,
      filter: true,
    }

    //根据配方单号带出数据
    const dcFocus = () => {
      if (dataForm.formulaOdd != "" && dataForm.formulaOdd != null && dataForm.formulaOdd != undefined) {
        post({
          url: "/pdm/CrockCalorie/select",
          data: {
            "formulaOdd": dataForm.formulaOdd,
          }
        })
            .then(({data, code}: any) => {
              if (code === 200) {
                pageData.dcList = data
              }
            })
      }
    }
    const pfChange = (val: any) => {
      if (pageData.formulaOddId == '') {
        pageData.flowCardCode = ""
        pageData.planOrderCode = ""
        pageData.property = ""
        pageData.greyCode = ""
        pageData.productName = ""
        return
      }
      let list = pageData.pfList.filter(function (o: any) {
        return o["id"] == val
      })
      pageData.flowCardCode = list[0]["flowCardCode"]
      pageData.planOrderCode = list[0]["planOrderCode"]
      pageData.property = list[0]["property"]
      pageData.greyCode = list[0]["greyCode"]
      pageData.productName = list[0]["productName"]
    }

    //下拉框   性质
    const focusSel = () => {
      selCxAll({property: ""});
    }
    const options = ref<any>(pageData.xzList);
    const loading = ref(false);
    const handleSearch = (value: any) => {
      if (value) {
        const ob = {property: value, deleteState: 0}
        loading.value = true;
        selCxAll(ob);
        options.value = pageData.xzList;
        loading.value = false;
      } else {
        options.value = []
      }
    };

    function selCxAll(val: any) {
      post({
        url: "/pdm/formulaAttribute/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.xzList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 5000,
          });
        }
      });
    }

    //下拉框  作业类型
    const focusSel1 = () => {
      selCxAll1({"jobType": ""});
    }
    const options1 = ref<any>(pageData.zyList);
    const loading1 = ref(false);
    const handleSearch1 = (value: any) => {
      if (value) {
        const ob = {jobType: value, deleteState: 0}
        loading1.value = true;
        selCxAll1(ob);
        options1.value = pageData.zyList;
        loading1.value = false;
      } else {
        options1.value = []
      }
    };

    function selCxAll1(val: any) {
      post({
        url: "/pdm/JobType/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.zyList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 6000,
          });
        }
      });
    }

    //下拉框  流程卡号
    const focusSel2 = () => {
      selCxAll2({"flowCardCode": ""});
    }
    const options2 = ref<any>(pageData.cardList);
    const loading2 = ref(false);
    const handleSearch2 = (value: any) => {
      if (value) {
        const ob = {flowCardCode: value}
        loading2.value = true;
        selCxAll2(ob);
        options2.value = pageData.cardList;
        loading2.value = false;
      } else {
        options2.value = []
      }
    };

    function selCxAll2(val: any) {
      post({
        url: "aps/circulatCard/getDropValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.cardList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 6000,
          });
        }
      });
    }

    //根据流转卡号带出
    const cardChange = () => {
      dataForm.customName = ""
      dataForm.colorCode = ""
      dataForm.colorName = ""
      dataForm.affirmColour = ""
      dataForm.houseNum = ""
      dataForm.alwaysWeight = ""
      dataForm.machineOdd = ""
      dataForm.greyCode = ""
      dataForm.productName = ""
      dataForm.planOrderCode = ""
      dataForm.yarnBatch = ""
      dataForm.efficacious = ""
      dataForm.gramWeight = ""
      dataForm.colourDepth = ""
      post({
        url: 'aps/circulatCard/getList',
        data: {
          flowCardCode: dataForm.flowCardCode
        }
      }).then((res: any) => {
        if (res.code == 200) {
          dataForm.customName = res.data[0].customName
          dataForm.colorCode = res.data[0].colorCode
          dataForm.colorName = res.data[0].colorName
          dataForm.affirmColour = res.data[0].affirmColor
          dataForm.houseNum = res.data[0].houseNum
          dataForm.alwaysWeight = res.data[0].flowCardWeight
          dataForm.machineOdd = res.data[0].machineCode
          dataForm.greyCode = res.data[0].greyCode
          dataForm.productName = res.data[0].productName
          dataForm.planOrderCode = res.data[0].planOrderCode
          dataForm.yarnBatch = res.data[0].yarnBatch
          dataForm.efficacious = res.data[0].efficacious
          dataForm.gramWeight = res.data[0].gramWeight
          dataForm.colourDepth = res.data[0].colourDepth
        }
      })
      Change4()
    }

    //下拉框 对色师傅
    const focusSel3 = () => {
      selCxAll3({"name": "", deleteState: 0});
    }
    const options3 = ref<any>(pageData.dsList);
    const loading3 = ref(false);
    const handleSearch3 = (value: any) => {
      if (value) {
        const ob = {name: value, deleteState: 0}
        loading3.value = true;
        selCxAll3(ob);
        options3.value = pageData.dsList;
        options3.value = pageData.zlList;
        options3.value = pageData.fyList;
        loading3.value = false;
      } else {
        options3.value = []
      }
    };

    function selCxAll3(val: any) {
      post({
        url: "/org/hrEmployee/getList",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.dsList = data;
          pageData.zlList = data;
          pageData.fyList = data;
        } else {

        }
      });
    }

    //下拉框 机台号
    const focusSel4 = () => {
      selCxAll4({field: 'controlMachineCode', deleteState: 0})
    }
    const options4 = ref<any>(pageData.machineList)
    const loading4 = ref(false)
    const handleSearch4 = (value: any) => {
      if (value) {
        const ob = {controlMachineCode: value, deleteState: 0}
        loading4.value = true
        selCxAll4(ob)
        options4.value = pageData.machineList
        loading4.value = false
      } else {
        options4.value = []
      }
    }

    function selCxAll4(val: any) {
      post({
        url: '/pdm/controlMachine/getSBMC',
        data: val,
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.machineList = data
        } else {
          Message.error({
            content: '查询失败！',
            duration: 5000,
          })
        }
      })
    }

    const handCode = (e: any) => {
      dataForm.machineOdd = e.split('——')[0]
      // dataForm.machineOdd = e.split('——')[1]
    }

    //下拉框  机速
    const focusSel5 = () => {
      selCxAll5({machineSpeed: "", deleteState: 0});
    }
    const options5 = ref<any>(pageData.jsList);
    const loading5 = ref(false);
    const handleSearch5 = (value: any) => {
      if (value) {
        const ob = {machineSpeed: value, deleteState: 0}
        loading5.value = true;
        selCxAll5(ob);
        options5.value = pageData.jsList;
        loading5.value = false;
      } else {
        options5.value = []
      }
    };

    function selCxAll5(val: any) {
      post({
        url: "/pdm/machineSpeed/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.jsList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 6000,
          });
        }
      });
    }


    //下拉框  风机
    const focusSel6 = () => {
      selCxAll6({draughtFan: "", deleteState: 0});
    }
    const options6 = ref<any>(pageData.fyList);
    const loading6 = ref(false);
    const handleSearch6 = (value: any) => {
      if (value) {
        const ob = {draughtFan: value, deleteState: 0}
        loading6.value = true;
        selCxAll6(ob);
        options5.value = pageData.fjList;
        loading6.value = false;
      } else {
        options6.value = []
      }
    };

    function selCxAll6(val: any) {
      post({
        url: "/pdm/machineSpeed/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.fjList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 6000,
          });
        }
      });
    }

    //下拉框  喷嘴
    const focusSel7 = () => {
      selCxAll7({nozzle: "", deleteState: 0});
    }
    const options7 = ref<any>(pageData.pzList);
    const loading7 = ref(false);
    const handleSearch7 = (value: any) => {
      if (value) {
        const ob = {nozzle: value, deleteState: 0}
        loading7.value = true;
        selCxAll7(ob);
        options5.value = pageData.pzList;
        loading7.value = false;
      } else {
        options7.value = []
      }
    };

    function selCxAll7(val: any) {
      post({
        url: "/pdm/machineSpeed/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.pzList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 7000,
          });
        }
      });
    }

    //下拉框  主泵
    const focusSel8 = () => {
      selCxAll8({mainPump: "", deleteState: 0});
    }
    const options8 = ref<any>(pageData.pzList);
    const loading8 = ref(false);
    const handleSearch8 = (value: any) => {
      if (value) {
        const ob = {mainPump: value, deleteState: 0}
        loading8.value = true;
        selCxAll8(ob);
        options8.value = pageData.zbList;
        loading8.value = false;
      } else {
        options8.value = []
      }
    };

    function selCxAll8(val: any) {
      post({
        url: "/pdm/machineSpeed/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.zbList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 8000,
          });
        }
      });
    }

    //拷贝  流转卡号
    const focusSel9 = () => {
      selCxAll9({flowCardCode: "", deleteState: 0});
    }
    const options9 = ref<any>(pageData.cardList2);
    const loading9 = ref(false);
    const handleSearch9 = (value: any) => {
      if (value) {
        const ob = {flowCardCode: value, deleteState: 0}
        loading9.value = true;
        selCxAll9(ob);
        options5.value = pageData.cardList2;
        loading9.value = false;
      } else {
        options9.value = []
      }
    };

    function selCxAll9(val: any) {
      post({
        url: "/pdm/CrockCalorie/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.cardList2 = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 9000,
          });
        }
      });
    }


    //拷贝  配方单号
    const focusSel10 = () => {
      selCxAll10({formulaOdd: "", deleteState: 0});
    }
    const options10 = ref<any>(pageData.oddList);
    const loading10 = ref(false);
    const handleSearch10 = (value: any) => {
      if (value) {
        const ob = {formulaOdd: value, deleteState: 0}
        loading10.value = true;
        selCxAll10(ob);
        options5.value = pageData.oddList;
        loading10.value = false;
      } else {
        options10.value = []
      }
    };

    function selCxAll10(val: any) {
      post({
        url: "/pdm/CrockCalorie/getFieldValue",
        data: val
      }).then(({data, code}: any) => {
        if (code === 200) {
          pageData.oddList = data;
        } else {
          Message.error({
            content: "查询失败！",
            duration: 10000,
          });
        }
      });
    }

    let selectedRowKeys1 = ref()
    let selectedRowKeys2 = ref()
    let selectedRowKeys3 = ref()
    const visible2 = ref(false)
    const addNumbers = () => {
      visible2.value = true
    }

    //添加程序号 弹窗
    const selectedRowKeys4: any = ref([])
    let Programs: any = ref([])
    let dataList: any = ref([])
    const programNumber: any = ref('')
    const programName: any = ref('')
    const pagingList1: any = ref(pagingList)
    let isTypeIds = 0
    const listPage: any = reactive({
      total: 0,
      size: 10,
      page: 1,
    })
    const PageSize2 = (val: any) => {
      listPage.page = val
      listQuery()
    }

    const change2 = (val: any) => {
      listPage.size = val
      listQuery()
    }
    const Query = () => {
      listPage.page = 1
      listQuery()
    }
    const listQuery = () => {
      pageData.pageLoading = true
      selectedRowKeys4.value = []
      post({
        url: 'pdm/ProcessFormula/selectForm',
        data: {
          page: listPage.page,
          size: listPage.size,
          deleteState: 0,
          programNumber: programNumber.value,
          programName: programName.value,
        },
      }).then(({data, code}: any) => {
        if (code === 200) {
          dataList.value = data.list
          listPage.total = data.total
          dataList.value.forEach((item: any) => {
            item['isTypeIds'] = isTypeIds++
          })
        }
      }).catch(console.log).finally(() => {
        pageData.pageLoading = false
      })
    }


    const handleOk = () => {
      if (selectedRowKeys4.value.length === 0) {
        Message.error('请勾选数据!')
        return false
      }
      if (selectedRowKeys4.value.length > 8) {
        Message.error('最多能勾选8条数据!')
        return false
      }
      let listArray: any = []
      for (let i = 0; i < dataList.value.length; i++) {
        if (selectedRowKeys4.value.includes(dataList.value[i].isTypeIds)) {
          listArray.push(dataList.value[i])
        }
      }
      if (Programs.value.length != 0) {
        let NumAarray: any = []
        for (let i = 0; i < listArray.length; i++) {
          NumAarray.push(listArray[i].programNumber)
        }
        for (let i = 0; i < Programs.value.length; i++) {
          if (NumAarray.includes(Programs.value[i].programNumber)) {
            Message.error(`不能重复添加程序号为 ${Programs.value[i].programNumber} 的信息!`)
            return false
          }
        }
      }

      let list = []
      for (let i = 0; i < listArray.length; i++) {
        var ob = {}
        ob['programNumber'] = listArray[i].programNumber
        list.push(ob)
      }
      post({
        url: '/pdm/ProcessFormula/selectGY',
        data: list
      }).then(({data, code}: any) => {
        if (code === 200) {
          for (let index in data) {
            for (let i in data[index]) {
              Programs.value.push(data[index][i])
            }
          }
          dataForm2.numbers = 0
          Programs.value.forEach((o: any) => {
            o.percentage = 0   //percentage
            o.adjust = 1      //调整系数
            if (o.salt == 1 || o.begins != 'A') {
              o.saltWater = 0
            } else if (o.salt == 0 || o.begins == 'A') {
              o.saltWater = 0
            }
            dataForm2.numbers += o.thickenerStep  //计算步骤个数
          })
          Programs.value.forEach((item: any) => {
            item['isTypeIds'] = isTypeIds++
          })
        }
      }).catch(console.log).finally(() => {
        pageData.pageLoading = false
      })
      programNumber.value = ''
      programName.value = ''
      dataList.value = []
      selectedRowKeys4.value = []
      listPage.total = 0
      visible2.value = false
      return true
    }
    const sideNo = () => {
      pageData.showAdd = false
      Programs.value = []
    }
    const handleNo = () => {
      programNumber.value = ''
      programName.value = ''
      dataList.value = []
      selectedRowKeys4.value = []
      listPage.total = 0
      visible2.value = false
    }
    //程序号删除
    const delRow = (record: any) => {
      //删除
      Programs.value = Programs.value.filter(function (o: any) {
        return o['programNumber'] !== record['programNumber']
      })
      //计算步骤个数
      dataForm2.numbers = 0
      let list = []
      for (let i = 0; i < Programs.value.length; i++) {
        list.push(Programs.value[i].thickenerStep)
      }
      for (let i = 0; i < list.length; i++) {
        dataForm2.numbers += list[i]
      }
    }

    //计算调整系数
    const Change2 = (record: any) => {
      var adjust = 1 + record.percentage / 100
      Programs.value.map((o: any) => {
        if (o.id == record.id) {
          o.adjust = adjust
        }
      })
    }

    //计算用料, 盐扣减水量
    const Change3 = (record: any) => {
      var material = record.waterYield * record.concentration / 1000
      Programs.value.map((o: any) => {
        if (o.id == record.id) {
          o.material = material
          var saltWater = record.material * 1000 / record.concentration
          o.saltWater = saltWater
        }
      })
    }

    let Crafts: any = ref([])
    let Tanks: any = ref([])
    //计算浴比
    const CountBath = () => {
      if (Programs.value.length === 0) {
        Message.error('请添加程序号！')
        return
      }
      if (dataForm.flowCardCode === "") {
        Message.error('请选择流转卡号！')
        return false
      }
      if (dataForm.machineOdd === "") {
        Message.error('请选择机台号！')
        return false
      }
      let list = []
      for (let i = 0; i < Programs.value.length; i++) {
        var ob = {}
        ob['programNumber'] = Programs.value[i].programNumber
        ob['assistantVatMinWater'] = 666
        ob['saltWater'] = Programs.value[i].saltWater
        list.push(ob)
      }
      post({
        url: "/pdm/CrockCalorie/calculate",
        data: {
          flowCardCode: dataForm.flowCardCode,
          greyCode: dataForm.greyCode,
          alwaysWeight: dataForm.alwaysWeight,
          controlMachineCode: dataForm.machineOdd,
          programNumberList: list
        }
      }).then(({code, data}: any) => {
        if (code == 200) {
          Crafts.value = data
          for (let i = 0; i < Programs.value.length; i++) {
            for (let j = 0; j < data.length; j++) {
              if (Programs.value[i].programNumber == data[j].programNumber) {
                Programs.value[i].bathRatio = data[j].YBPC
                Programs.value[i].bathRatioOne = data[j].bathRatioOne
              }
            }
          }
        }
      })
    }

    const Change4 = () => {
      if (dataForm.property != "" && dataForm.flowCardCode != "")
        post({
          url: "/pdm/CrockCalorie/selectProperty",
          data: {
            property: dataForm.property,
            flowCardCode: dataForm.flowCardCode
          }
        }).then(({code, data}: any) => {
          if (code == 200) {
            dataForm.propertyStater = dataForm.property + "-" + data
          }
        })
    }

    const getCurrentData = () => {
      return moment(new Date()).format('YYYY-MM-DD')
    }
    const handoff = (key: any) => {
      id.value = key;
      if (id.value == 1) {
        table.handleSuccess(tableList1)
      } else {
        table.handleSuccess(tableList2)
      }
    }
    let tableList1 = ref([]);
    let tableList2 = ref([]);
    const localeText1: any = ref(localeText)


    let visible = ref(false)
    let idList: any = ref([])
    let idList2: any = ref([])
    let idList3: any = ref([])
    let idList4: any = ref([])
    let idList5: any = ref([])
    let idList6: any = ref([])
    const dying = () => {
      post({
        url: '/pdm/CrockCalorie/selectDYZC',
        data: {
          formulaOdd: gridOption.value.getSelectedRows()[0].formulaOdd,
        },
      }).then(({code, data, timeStamp}: any) => {
        if (code == 200) {
          pageData.nowTime = timeStamp
          idList.value = data
          idList2.value = data[0].CrockCalorieDetail
          //打印一维码
          idList.value.map((o: any) => {
            o.tubeType = data[0].ControlMachine.tubeType
            o.coordinate = data[0].ControlMachine.coordinate
            o.formulaOdd = data[0].formulaOdd
            nextTick(() => {
              JsBarcode('#barcode', String(o.formulaOdd), {
                format: 'CODE39', //选择要使用的条形码类型
                displayValue: true, //是否在条形码下方显示文字
                fontOptions: 'bold', //使文字加粗体或变斜体
                fontSize: 35,
              })
              return
            })
          })

          //计算湿布进水量
          for (let i = 0; i < idList2.value.length; i++) {
            for (let j = 0; j < data[0].CrockCalorieDetail.length; j++) {
              if (idList2.value[i].processName == data[0].CrockCalorieDetail[j].processName) {
                // 湿布进水量=总水量-副缸扣减量-盐扣减量-吸水率*重量
                idList2.value[i].waterCloth = (idList2.value[i].waterYield - idList2.value[i].abatement - idList2.value[i].abatementWater - data[0].dyeWater) * data[0].gramWeight
              }
            }
          }
          let list = []
          for (let i = 0; i < data[0].CrockCalorieDetail.length; i++) {
            var ob = {}
            ob['processName'] = data[0].CrockCalorieDetail[i].processName
            if (ob['processName'] === "前处理") {
              idList3.value = data
            } else if (idList3.value = []) {
              idList3.value = " "
            }
            if (ob['processName'] === "染色") {
              idList4.value = data
            }
            // else if (idList4.value = []) {
            //     idList4.value = " "
            // }
            if (ob['processName'] === "后处理") {
              idList5.value = data
            } else if (idList5.value = []) {
              idList5.value = " "
            }
          }
        }
      })
    }

    //打印正常单
    const visible6 = ref(false)
    const handleOk6 = () => {
      printJS({
        printable: 'Normal',
        type: 'html',
        targetStyles: ['*'],
      })
    }
    const dyNormal = () => {
      if (gridOption.value.getSelectedRows().length == 0) {
        Message.error('请先勾选一条数据')
        return
      }
      if (gridOption.value.getSelectedRows().length > 1) {
        Message.error('只能勾选一条数据')
        return
      }
      dying()
      visible6.value = true
    }

    //打印加料单
    const visible7 = ref(false)
    const handleOk7 = () => {
      printJS({
        printable: 'Feeding',
        type: 'html',
        targetStyles: ['*'],
      })
    }
    const dyFeed = () => {
      if (gridOption.value.getSelectedRows().length == 0) {
        Message.error('请先勾选一条数据')
        return
      }
      if (gridOption.value.getSelectedRows().length > 1) {
        Message.error('只能勾选一条数据')
        return
      }
      dying()
      visible7.value = true
    }

    //套打染部工作单
    const visible8 = ref(false)
    const handleOk8 = () => {
      printJS({
        printable: 'Work',
        type: 'html',
        targetStyles: ['*'],
      })
    }
    const dyWork = () => {
      if (gridOption.value.getSelectedRows().length == 0) {
        Message.error('请先勾选一条数据')
        return
      }
      if (gridOption.value.getSelectedRows().length > 1) {
        Message.error('只能勾选一条数据')
        return
      }
      dying()
      visible8.value = true
    }

    const visible3 = ref(false)
    const visible4 = ref(false)
    const visible5 = ref(false)
    const selectedRowKeys5: any = ref([])
    let cardList: any = ref([])
    const handleOk1 = () => {
      post({
        url: "/pdm/CrockCalorie/selectMap",
        data: {
          flowCardCode: dataForm3.flowCardCode,
          deteleState: 0,
        }
      }).then(({code, data}: any) => {
        if (code === 200) {
          cardList.value = data.CrockCalorie
          visible4.value = true
        }
      })
      visible3.value = false
      dataForm3.flowCardCode = ""
    }

    const handleCancel1 = () => {
      visible3.value = false
      dataForm3.flowCardCode = ""
    }

    const handleOk2 = () => {
      if (selectedRowKeys5.value.length === 0) {
        Message.error('请勾选一条数据!')
        return
      }
      let card = cardList.value.filter((val: any) => {
        return val.formulaOdd == selectedRowKeys5.value
      })
      post({
        url: "/pdm/CrockCalorie/selectMap",
        data: {
          formulaOdd: card[0].formulaOdd,
          deteleState: 0,
        }
      }).then(({code, data}: any) => {
        if (code == 200) {
          Programs.value = data.CrockCalorieDetail
          for (let i = 0; i < Programs.value.length; i++) {
            for (let j = 0; j < data.CrockCalorieDetail.length; j++) {
              if (Programs.value[i].id == data.CrockCalorieDetail[j].id) {
                Programs.value[i].dyeProcessName = data.CrockCalorieDetail[j].processName
                Programs.value[i].thickenerStep = data.CrockCalorieDetail[j].processCode
                Programs.value[i].bathRatio = data.CrockCalorieDetail[j].bathRatioOne
                Programs.value[i].materialRatio = data.CrockCalorieDetail[j].proportion
                Programs.value[i].concentrationUnit = data.CrockCalorieDetail[j].conUnits
                Programs.value[i].material = data.CrockCalorieDetail[j].ingredient
                Programs.value[i].unit = data.CrockCalorieDetail[j].ingUnits
                Programs.value[i].operatingSteps = data.CrockCalorieDetail[j].handleProcess
                Programs.value[i].automanual = data.CrockCalorieDetail[j].manuAuto
                Programs.value[i].assistantVatMinWater = data.CrockCalorieDetail[j].abatement
                Programs.value[i].saltWater = data.CrockCalorieDetail[j].abatementWater
                Programs.value[i].MaxLimit = data.CrockCalorieDetail[j].maxConcentration
                Programs.value[i].chargingBasket = data.CrockCalorieDetail[j].pailCode
                Programs.value[i].bathRatioOne = data.CrockCalorieDetail[j].bathRatioTwo
                Programs.value[i].meansDelivery = data.CrockCalorieDetail[j].convey
              }
            }
          }
          selectedRowKeys5.value = []
          visible4.value = false
        }
      })
    }

    const handleCancel2 = () => {
      selectedRowKeys5.value = []
      visible4.value == false
    }

    const handleOk3 = () => {
      post({
        url: "/pdm/CrockCalorie/selectMap",
        data: {
          formulaOdd: dataForm3.formulaOdd,
          deteleState: 0,
        }
      }).then(({code, data}: any) => {
        if (code == 200) {
          Programs.value = data.CrockCalorieDetail
          for (let i = 0; i < Programs.value.length; i++) {
            for (let j = 0; j < data.CrockCalorieDetail.length; j++) {
              if (Programs.value[i].id == data.CrockCalorieDetail[j].id) {
                Programs.value[i].dyeProcessName = data.CrockCalorieDetail[j].processName
                Programs.value[i].thickenerStep = data.CrockCalorieDetail[j].processCode
                Programs.value[i].bathRatio = data.CrockCalorieDetail[j].bathRatioOne
                Programs.value[i].materialRatio = data.CrockCalorieDetail[j].proportion
                Programs.value[i].concentrationUnit = data.CrockCalorieDetail[j].conUnits
                Programs.value[i].material = data.CrockCalorieDetail[j].ingredient
                Programs.value[i].unit = data.CrockCalorieDetail[j].ingUnits
                Programs.value[i].operatingSteps = data.CrockCalorieDetail[j].handleProcess
                Programs.value[i].automanual = data.CrockCalorieDetail[j].manuAuto
                Programs.value[i].assistantVatMinWater = data.CrockCalorieDetail[j].abatement
                Programs.value[i].saltWater = data.CrockCalorieDetail[j].abatementWater
                Programs.value[i].MaxLimit = data.CrockCalorieDetail[j].maxConcentration
                Programs.value[i].chargingBasket = data.CrockCalorieDetail[j].pailCode
                Programs.value[i].bathRatioOne = data.CrockCalorieDetail[j].bathRatioTwo
                Programs.value[i].meansDelivery = data.CrockCalorieDetail[j].convey
              }
            }
          }
          visible5.value = false
          dataForm3.formulaOdd = ''
        }
      })
    }

    const handleCancel3 = () => {
      visible5.value = false
      dataForm3.formulaOdd == ''
    }

    //导入中转站
    const ImportBroker = () => {
      if (gridOption.value.getSelectedRows().length === 0) {
        Message.error('请先勾选数据!')
        return;
      }
      var list: any = [];
      for (let i = 0; i < gridOption.value.getSelectedRows().length; i++) {
        var ob = {};
        ob["leadState"] = 1
        ob["ids"] = gridOption.value.getSelectedRows()[i].id
        ob["formulaOdd"] = gridOption.value.getSelectedRows()[i].formulaOdd
        ob["flowCardCode"] = gridOption.value.getSelectedRows()[i].flowCardCode
        ob["property"] = gridOption.value.getSelectedRows()[i].property
        ob["machineOdd"] = gridOption.value.getSelectedRows()[i].machineOdd
        ob["remark"] = gridOption.value.getSelectedRows()[i].remark
        ob["TransitShipment"] = gridOption.value.getSelectedRows()[i].TransitShipment
        list.push(ob)
      }

      Modal.confirm({
        title: '系统提示',
        content: '是否将此单号导入中转站',
        onOk() {
          post({
            url: "/pdm/CrockCalorie/updateState",
            data: list
          }).then((res: any) => {
            if (res.code === 200) {
              doRefresh();
              Message.success('导入成功')
            } else {
              Message.error(res.message)
            }
          })
        }
      })
    }


    const Change5 = () => {
      Programs.value.forEach((item: any, index: any) => {
        if (item.alwaysConcentration > item.MaxLimit) {
          Message.warning(`${item.materialName}工艺单次盐碱用量超出限制，请调整单次盐碱用量或更换工艺开单!`)
          item.alwaysConcentration = 0
          return
        }
      })
    }

    const {saveGridState: saveGridState01, updateGridState: updateGridState01} = saveOrUpdateGridState01('TrackingNumbersDetails01', gridOption, colState, tc)
    const onColumnMoved = () => {
      saveGridState01()
    }
    const onColumnResized = () => {
      saveGridState01()
    }
    return {
      saveOrUpdateGridState01,
      saveGridState01,
      updateGridState01,
      onColumnMoved,
      onColumnResized,
      colState,
      idList3,
      idList4,
      idList5,
      idList6,
      handCode,
      cardList,
      handleOk,
      handleOk1,
      handleOk2,
      handleOk3,
      handleCancel1,
      handleCancel2,
      handleCancel3,
      handleNo,
      ImportBroker,
      idList,
      idList2,
      Change4,
      Change5,
      pageData,
      dataForm,
      dataForm2,
      dataForm3,
      CountBath,
      Change2,
      Change3,
      delRow,
      Programs,
      programNumber,
      programName,
      Query,
      dataList,
      pagingList1,
      localeText1,
      listPage,
      PageSize,
      PageSize2,
      change1,
      change2,
      addNumbers,
      Crafts,
      Tanks,
      tableColumns1,
      tableColumns2,
      tableColumns3,
      tableColumns4,
      tableColumns5,
      tableColumns6,
      tableColumns7,
      selectedRowKeys,
      selectedRowKeys1,
      selectedRowKeys2,
      selectedRowKeys3,
      selectedRowKeys4,
      selectedRowKeys5,
      cardChange,
      getCurrentData,
      options,
      options1,
      options2,
      options3,
      options4,
      options5,
      options6,
      options7,
      options8,
      options9,
      options10,
      loading,
      loading1,
      loading2,
      loading3,
      loading4,
      loading5,
      loading6,
      loading7,
      loading8,
      loading9,
      loading10,
      handleSearch,
      handleSearch1,
      handleSearch2,
      handleSearch3,
      handleSearch4,
      handleSearch5,
      handleSearch6,
      handleSearch7,
      handleSearch8,
      handleSearch9,
      handleSearch10,
      focusSel,
      focusSel1,
      focusSel2,
      focusSel3,
      focusSel4,
      focusSel5,
      focusSel6,
      focusSel7,
      focusSel8,
      focusSel9,
      focusSel10,
      handleOk6,
      handleOk7,
      handleOk8,
      dying,
      dyNormal,
      dyWork,
      dyFeed,
      handoff,
      visible,
      visible1,
      cxDetails,
      pfChange,
      dcFocus,
      editHandler,
      deleteHandler,
      addHandler,
      selectHandler,
      sideOk,
      sideNo,
      formRef,
      pagination,
      table,
      rowKey,
      headerShow,
      handleChange,
      defaultColDef,
      tc,
      tc2,
      gridOption,
      gridReady,
      total,
      page,
      size,
      visible2,
      visible3,
      visible4,
      visible5,
      visible6,
      visible7,
      visible8,
    };
  },
  components: {Toolbar, PageTabelLayout, }
}
</script>
<style scoped lang="less">
:deep(.ag-cell) {
  border-right: 1px solid #dde2eb;
}

:deep(.ag-header-cell) {
  border-right: 1px solid #dde2eb;
}

:deep(.ag-cell-value) {
  user-select: initial;
  -moz-user-select: text;
  -ms-user-select: text;
  -webkit-user-select: text;
}

:deep(.arco-table-td-content) {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.isTable {
  margin-top: 100px;
  width: 90%;
  margin: 0 auto;
  text-align: center;
  border-collapse: collapse;
  border: 1px solid #ccc;

  td {
    border: 1px solid #ccc;
  }
}

.isTable2 {
  margin-top: 100px;
  width: 90%;
  margin: 0 auto;
  text-align: center;
  border-collapse: collapse;
  border: 1px solid #ccc;

  tr {
    border: 1px solid #ccc;
  }
}

.isTable3 {
  margin-top: 100px;
  width: 90%;
  margin: 0 auto;
  text-align: center;

  border-collapse: collapse;
  border: 1px solid #ccc;
}

#barcode {
  width: 350px !important;
  height: 50px !important;
  font-weight: 500;
  float: right;
  margin-top: -20px;
}

.divider-demo {
  box-sizing: border-box;
  width: 560px;
  padding: 24px;
  border: 30px solid rgb(var(--gray-2));
}
</style>